<template>
    <a-input @change="inputVal" allowClear class="w-full" v-model:value="value" :placeholder="props.placeholder">
        <template #suffix>
            <sysIcon class=" text-gray-400" type="system-changyong_sousuo"></sysIcon>
        </template>
    </a-input>
</template>
<script setup>
const emits = defineEmits(["update:value"]);
const props = defineProps({
    value: String,
    placeholder: {
        type: String,
        default: "请输入",
    },
});
const state = reactive({
    value: undefined,
});
state.value = props.value;
const inputVal = () => {
    emits("update:value", state.value);
};
watch(
    () => props.value,
    (newVal, oldVal) => {
        if (newVal === undefined) {
            state.value = undefined;
        } else {
            state.value = newVal;
        }
    },
    { deep: true }
);
defineExpose({});
const { value } = toRefs(state);
</script>

